[FORMAT "WCOFF"]
[INSTRSET "i486p"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 32]
	EXTERN	__alloca
	EXTERN	_api_cmdline
	EXTERN	_api_openwin
	EXTERN	_api_putstrwin
	EXTERN	_api_boxfilwin
	EXTERN	_api_fopen
	EXTERN	_api_fsize
	EXTERN	_api_fread
	EXTERN	_api_fclose
	EXTERN	_api_alloctimer
	EXTERN	_api_inittimer
	EXTERN	_api_refreshwin
	EXTERN	_strtol
	EXTERN	_tonetable.0
	EXTERN	_api_beep
	EXTERN	_notetable.1
	EXTERN	_api_settimer
	EXTERN	_api_getkey
	EXTERN	_api_end
	EXTERN	_api_putstr0
[FILE "mmlplay.c"]
[SECTION .data]
_tonetable.0:
	DD	1071618315
	DD	1135340056
	DD	1202850889
	DD	1274376125
	DD	1350154473
	DD	1430438836
	DD	1515497155
	DD	1605613306
	DD	1701088041
	DD	1802240000
	DD	1909406767
	DD	2022946002
	ALIGNB	4
_notetable.1:
	DD	9
	DD	11
	DD	0
	DD	2
	DD	4
	DD	5
	DD	7
LC0:
	DB	"file open error.",0x0A,0x00
LC1:
	DB	"mmlplay",0x00
LC3:
	DB	"mml syntax error.",0x0A,0x00
LC2:
	DB	"karaoke too long.",0x0A,0x00
[SECTION .text]
	GLOBAL	_HariMain
_HariMain:
	PUSH	EBP
	MOV	EAX,131140
	MOV	EBP,ESP
	PUSH	EDI
	PUSH	ESI
	PUSH	EBX
	LEA	EBX,DWORD [-131116+EBP]
	CALL	__alloca
	PUSH	30
	PUSH	EBX
	MOV	DWORD [-131132+EBP],120
	MOV	DWORD [-131136+EBP],48
	MOV	DWORD [-131140+EBP],4
	MOV	DWORD [-131144+EBP],7
	MOV	DWORD [-131148+EBP],0
	CALL	_api_cmdline
	MOV	ECX,EBX
	POP	EAX
	MOV	DWORD [-131120+EBP],EBX
	POP	EDX
	CMP	BYTE [-131116+EBP],32
	JLE	L118
	LEA	EDX,DWORD [-131115+EBP]
L6:
	MOV	EAX,EDX
	MOV	DWORD [-131120+EBP],EDX
	LEA	EDX,DWORD [2+ECX]
	MOV	ECX,EAX
	CMP	BYTE [-1+EDX],32
	JG	L6
L118:
	MOV	ECX,DWORD [-131120+EBP]
	CMP	BYTE [ECX],32
	JE	L139
L120:
	CLD
	OR	ECX,-1
	XOR	EAX,EAX
	MOV	EDI,DWORD [-131120+EBP]
	REPNE
	SCASB
	NOT	ECX
	LEA	ESI,DWORD [-1+ECX]
	CMP	ESI,12
	JLE	L12
L13:
	PUSH	LC0
	CALL	_end
	POP	EDI
L12:
	TEST	ESI,ESI
	JNE	L14
	PUSH	0
	CALL	_end
	POP	EBX
L14:
	PUSH	LC1
	LEA	EAX,DWORD [-28684+EBP]
	PUSH	-1
	PUSH	112
	PUSH	256
	PUSH	EAX
	CALL	_api_openwin
	PUSH	DWORD [-131120+EBP]
	PUSH	ESI
	MOV	DWORD [-131124+EBP],EAX
	PUSH	0
	PUSH	32
	PUSH	128
	PUSH	EAX
	CALL	_api_putstrwin
	ADD	ESP,44
	PUSH	7
	PUSH	76
	PUSH	247
	PUSH	60
	PUSH	8
	PUSH	DWORD [-131124+EBP]
	CALL	_api_boxfilwin
	PUSH	7
	PUSH	105
	PUSH	249
	PUSH	86
	PUSH	6
	PUSH	DWORD [-131124+EBP]
	CALL	_api_boxfilwin
	ADD	ESP,48
	PUSH	DWORD [-131120+EBP]
	CALL	_api_fopen
	POP	ECX
	MOV	ESI,EAX
	TEST	EAX,EAX
	JE	L13
	PUSH	0
	PUSH	EAX
	CALL	_api_fsize
	MOV	EDI,EAX
	POP	EAX
	POP	EDX
	CMP	EDI,102399
	JLE	L16
	MOV	EDI,102399
L16:
	PUSH	ESI
	LEA	EBX,DWORD [-131084+EBP]
	PUSH	EDI
	PUSH	EBX
	CALL	_api_fread
	PUSH	ESI
	XOR	ESI,ESI
	CALL	_api_fclose
	MOV	BYTE [-131084+EBP+EDI*1],0
	ADD	ESP,16
	MOV	ECX,EBX
	MOV	DWORD [-131120+EBP],EBX
	CMP	BYTE [-131084+EBP],0
	JE	L122
L40:
	TEST	ESI,ESI
	JNE	L21
	MOV	EDX,DWORD [-131120+EBP]
	MOV	AL,BYTE [EDX]
	CMP	AL,32
	JLE	L21
	CMP	AL,47
	JE	L140
	CMP	AL,34
	JE	L141
L133:
	MOV	BYTE [ECX],AL
L134:
	INC	ECX
L19:
	MOV	EDX,DWORD [-131120+EBP]
	LEA	EAX,DWORD [1+EDX]
	MOV	DWORD [-131120+EBP],EAX
	CMP	BYTE [1+EDX],0
	JNE	L40
L122:
	MOV	BYTE [ECX],0
	CALL	_api_alloctimer
	PUSH	128
	PUSH	EAX
	MOV	DWORD [-131128+EBP],EAX
	CALL	_api_inittimer
	LEA	EAX,DWORD [-131084+EBP]
	MOV	DWORD [-131120+EBP],EAX
L136:
	POP	ESI
	POP	EDI
L41:
	MOV	ECX,DWORD [-131120+EBP]
	MOV	DL,BYTE [ECX]
	LEA	EAX,DWORD [-65+EDX]
	CMP	AL,6
	JBE	L45
	CMP	DL,82
	JE	L131
	CMP	DL,60
	JE	L143
	CMP	DL,62
	JE	L144
	CMP	DL,79
	JE	L145
	CMP	DL,81
	JE	L146
	CMP	DL,76
	JE	L147
	MOV	AL,BYTE [ECX]
	CMP	AL,84
	JE	L148
	CMP	AL,36
	JE	L149
	TEST	AL,AL
	JNE	L80
	LEA	EAX,DWORD [-131084+EBP]
	MOV	DWORD [-131120+EBP],EAX
	JMP	L41
L80:
	PUSH	LC3
	CALL	_end
	POP	EAX
	JMP	L41
L149:
	CMP	BYTE [1+ECX],75
	JE	L150
L90:
	MOV	EAX,DWORD [-131120+EBP]
	CMP	BYTE [EAX],59
	JE	L130
L113:
	MOV	EDX,DWORD [-131120+EBP]
	CMP	BYTE [EDX],0
	JE	L80
	LEA	EAX,DWORD [1+EDX]
	MOV	DWORD [-131120+EBP],EAX
	CMP	BYTE [1+EDX],59
	JNE	L113
L130:
	INC	DWORD [-131120+EBP]
	JMP	L41
L150:
	LEA	EAX,DWORD [2+ECX]
	MOV	DWORD [-131120+EBP],EAX
	CMP	BYTE [2+ECX],34
	JE	L127
L96:
	MOV	EDX,DWORD [-131120+EBP]
	CMP	BYTE [EDX],0
	JE	L80
	LEA	EAX,DWORD [1+EDX]
	MOV	DWORD [-131120+EBP],EAX
	CMP	BYTE [1+EDX],34
	JNE	L96
L127:
	INC	DWORD [-131120+EBP]
	XOR	ESI,ESI
L105:
	MOV	EDX,DWORD [-131120+EBP]
	MOV	AL,BYTE [EDX]
	TEST	AL,AL
	JE	L80
	CMP	AL,34
	JE	L98
	CMP	AL,37
	JE	L151
	MOV	BYTE [-131116+EBP+ESI*1],AL
	INC	DWORD [-131120+EBP]
L99:
	INC	ESI
	CMP	ESI,31
	JLE	L105
L98:
	CMP	ESI,30
	JLE	L106
	PUSH	LC2
	CALL	_end
	POP	EDX
L106:
	PUSH	7
	MOV	EBX,DWORD [-131124+EBP]
	PUSH	103
	INC	EBX
	PUSH	247
	PUSH	88
	PUSH	8
	PUSH	EBX
	CALL	_api_boxfilwin
	ADD	ESP,24
	MOV	BYTE [-131116+EBP+ESI*1],0
	TEST	ESI,ESI
	JE	L107
	LEA	EAX,DWORD [-131116+EBP]
	LEA	EDX,DWORD [0+ESI*4]
	PUSH	EAX
	MOV	EAX,128
	PUSH	ESI
	SUB	EAX,EDX
	PUSH	0
	PUSH	88
	PUSH	EAX
	PUSH	EBX
	CALL	_api_putstrwin
	ADD	ESP,24
L107:
	PUSH	104
	PUSH	248
	PUSH	88
	PUSH	8
	PUSH	DWORD [-131124+EBP]
	CALL	_api_refreshwin
	ADD	ESP,20
	JMP	L90
L151:
	MOV	AL,BYTE [1+EDX]
	MOV	BYTE [-131116+EBP+ESI*1],AL
	ADD	DWORD [-131120+EBP],2
	JMP	L99
L148:
	PUSH	10
	LEA	EAX,DWORD [-131120+EBP]
	PUSH	EAX
	LEA	EAX,DWORD [1+ECX]
	PUSH	EAX
	CALL	_strtol
	MOV	DWORD [-131132+EBP],EAX
L135:
	ADD	ESP,12
	JMP	L41
L147:
	PUSH	10
	LEA	EAX,DWORD [-131120+EBP]
	PUSH	EAX
	LEA	EAX,DWORD [1+ECX]
	PUSH	EAX
	CALL	_strtol
	ADD	ESP,12
	TEST	EAX,EAX
	MOV	DWORD [-131136+EBP],EAX
	JE	L80
	MOV	EDX,192
	MOV	EAX,EDX
	CDQ
	IDIV	DWORD [-131136+EBP]
	MOV	DWORD [-131136+EBP],EAX
	MOV	EAX,DWORD [-131120+EBP]
	CMP	BYTE [EAX],46
L138:
	JNE	L41
	MOV	ECX,DWORD [-131120+EBP]
	MOV	EBX,2
	LEA	EAX,DWORD [1+ECX]
	MOV	DWORD [-131120+EBP],EAX
	MOV	EAX,DWORD [-131136+EBP]
	CDQ
	IDIV	EBX
	ADD	DWORD [-131136+EBP],EAX
	CMP	BYTE [1+ECX],46
	JMP	L138
L146:
	PUSH	10
	LEA	EAX,DWORD [-131120+EBP]
	PUSH	EAX
	LEA	EAX,DWORD [1+ECX]
	PUSH	EAX
	CALL	_strtol
	MOV	DWORD [-131144+EBP],EAX
	JMP	L135
L145:
	PUSH	10
	LEA	EAX,DWORD [-131120+EBP]
	PUSH	EAX
	LEA	EAX,DWORD [1+ECX]
	PUSH	EAX
	CALL	_strtol
	MOV	DWORD [-131140+EBP],EAX
	JMP	L135
L144:
	LEA	EAX,DWORD [1+ECX]
	INC	DWORD [-131140+EBP]
	MOV	DWORD [-131120+EBP],EAX
	JMP	L41
L143:
	LEA	EAX,DWORD [1+ECX]
	DEC	DWORD [-131140+EBP]
	MOV	DWORD [-131120+EBP],EAX
	JMP	L41
L131:
	XOR	ESI,ESI
	MOV	BYTE [-131116+EBP],0
L47:
	LEA	EAX,DWORD [1+ECX]
	MOV	DWORD [-131120+EBP],EAX
	MOV	EDX,EAX
	MOV	AL,BYTE [1+ECX]
	CMP	AL,43
	JE	L49
	CMP	AL,45
	JE	L49
	CMP	AL,35
	JE	L49
L48:
	CMP	ESI,DWORD [-131148+EBP]
	JE	L52
	PUSH	8
	MOV	EBX,DWORD [-131124+EBP]
	PUSH	51
	INC	EBX
	PUSH	63
	PUSH	36
	PUSH	32
	PUSH	EBX
	CALL	_api_boxfilwin
	ADD	ESP,24
	CMP	BYTE [-131116+EBP],0
	JE	L53
	LEA	EAX,DWORD [-131116+EBP]
	PUSH	EAX
	PUSH	4
	PUSH	10
	PUSH	36
	PUSH	32
	PUSH	EBX
	CALL	_api_putstrwin
	ADD	ESP,24
L53:
	PUSH	52
	PUSH	64
	PUSH	36
	PUSH	32
	PUSH	DWORD [-131124+EBP]
	CALL	_api_refreshwin
	ADD	ESP,20
	MOV	EAX,DWORD [-131148+EBP]
	SUB	EAX,28
	CMP	EAX,79
	JA	L54
	IMUL	EAX,DWORD [-131148+EBP],3
	PUSH	7
	PUSH	76
	LEA	EDX,DWORD [-74+EAX]
	PUSH	EDX
	SUB	EAX,76
	PUSH	60
	PUSH	EAX
	PUSH	DWORD [-131124+EBP]
	CALL	_api_boxfilwin
	ADD	ESP,24
L54:
	LEA	EAX,DWORD [-28+ESI]
	CMP	EAX,79
	JA	L55
	IMUL	EAX,ESI,3
	PUSH	4
	PUSH	76
	LEA	EDX,DWORD [-74+EAX]
	PUSH	EDX
	SUB	EAX,76
	PUSH	60
	PUSH	EAX
	PUSH	DWORD [-131124+EBP]
	CALL	_api_boxfilwin
	ADD	ESP,24
L55:
	CMP	BYTE [-131116+EBP],0
	JE	L56
	MOV	EDX,12
	MOV	EAX,ESI
	MOV	ECX,EDX
	CDQ
	IDIV	ECX
	MOV	ECX,17
	SUB	ECX,EAX
	MOV	EAX,DWORD [_tonetable.0+EDX*4]
	SAR	EAX,CL
	PUSH	EAX
L137:
	CALL	_api_beep
	MOV	DWORD [-131148+EBP],ESI
	POP	EBX
L52:
	MOV	EDX,DWORD [-131120+EBP]
	MOV	AL,BYTE [EDX]
	SUB	EAX,48
	CMP	AL,9
	JA	L58
	PUSH	10
	LEA	EAX,DWORD [-131120+EBP]
	PUSH	EAX
	PUSH	EDX
	CALL	_strtol
	ADD	ESP,12
	MOV	EDX,192
	MOV	ECX,EAX
	MOV	EAX,EDX
	CDQ
	IDIV	ECX
	MOV	ESI,EAX
L59:
	MOV	EAX,DWORD [-131120+EBP]
	CMP	BYTE [EAX],46
	JE	L64
L124:
	IMUL	ESI,ESI,125
	MOV	EAX,ESI
	CDQ
	IDIV	DWORD [-131132+EBP]
	CMP	BYTE [-131116+EBP],0
	MOV	EBX,EAX
	MOV	ESI,EAX
	JE	L65
	CMP	DWORD [-131144+EBP],7
	JG	L65
	MOV	EAX,DWORD [-131120+EBP]
	CMP	BYTE [EAX],38
	JE	L65
	IMUL	ESI,DWORD [-131144+EBP]
	MOV	EDX,8
	MOV	EAX,ESI
	MOV	ECX,EDX
	CDQ
	IDIV	ECX
	PUSH	EAX
	MOV	EDI,EAX
	PUSH	DWORD [-131128+EBP]
	CALL	_waittimer
	PUSH	8
	PUSH	51
	PUSH	63
	PUSH	36
	PUSH	32
	PUSH	DWORD [-131124+EBP]
	CALL	_api_boxfilwin
	ADD	ESP,32
	MOV	EAX,DWORD [-131148+EBP]
	SUB	EAX,28
	CMP	EAX,79
	JA	L66
	IMUL	EAX,DWORD [-131148+EBP],3
	PUSH	7
	PUSH	76
	LEA	EDX,DWORD [-74+EAX]
	PUSH	EDX
	SUB	EAX,76
	PUSH	60
	PUSH	EAX
	PUSH	DWORD [-131124+EBP]
	CALL	_api_boxfilwin
	ADD	ESP,24
L66:
	PUSH	0
	MOV	DWORD [-131148+EBP],0
	CALL	_api_beep
	POP	ECX
L67:
	SUB	EBX,EDI
	PUSH	EBX
	PUSH	DWORD [-131128+EBP]
	CALL	_waittimer
	JMP	L136
L65:
	MOV	EAX,DWORD [-131120+EBP]
	XOR	EDI,EDI
	CMP	BYTE [EAX],38
	JNE	L67
	INC	EAX
	MOV	DWORD [-131120+EBP],EAX
	JMP	L67
L64:
	LEA	EDI,DWORD [1+EAX]
	MOV	EDX,2
	MOV	EAX,ESI
	MOV	EBX,EDX
	CDQ
	IDIV	EBX
	MOV	DWORD [-131120+EBP],EDI
	ADD	ESI,EAX
	MOV	EAX,EDI
	CMP	BYTE [EDI],46
	JE	L64
	JMP	L124
L58:
	MOV	ESI,DWORD [-131136+EBP]
	JMP	L59
L56:
	PUSH	0
	JMP	L137
L49:
	MOV	AL,BYTE [EDX]
	MOV	BYTE [-131113+EBP],AL
	CMP	BYTE [EDX],45
	JE	L152
	INC	ESI
L51:
	LEA	EAX,DWORD [1+EDX]
	MOV	DWORD [-131120+EBP],EAX
	JMP	L48
L152:
	DEC	ESI
	JMP	L51
L45:
	CMP	DL,82
	JE	L131
	IMUL	EAX,DWORD [-131140+EBP],12
	MOVSX	EDX,DL
	MOV	BYTE [-131116+EBP],79
	ADD	EAX,DWORD [_notetable.1-260+EDX*4]
	LEA	ESI,DWORD [12+EAX]
	MOV	AL,BYTE [-131140+EBP]
	ADD	EAX,48
	MOV	BYTE [-131115+EBP],AL
	MOV	AL,BYTE [ECX]
	MOV	BYTE [-131114+EBP],AL
	MOV	BYTE [-131113+EBP],32
	MOV	BYTE [-131112+EBP],0
	JMP	L47
L141:
	MOV	BYTE [ECX],34
	MOV	ESI,3
	INC	ECX
	JMP	L19
L140:
	MOV	AL,BYTE [1+EDX]
	CMP	AL,42
	JE	L153
	CMP	AL,47
	JE	L154
	MOV	BYTE [ECX],47
	MOV	EAX,DWORD [-131120+EBP]
	MOV	AL,BYTE [EAX]
	SUB	EAX,97
	CMP	AL,25
	JA	L134
	MOV	BYTE [ECX],15
	JMP	L134
L154:
	MOV	ESI,2
	JMP	L19
L153:
	MOV	ESI,1
	JMP	L19
L21:
	CMP	ESI,1
	JE	L155
L32:
	CMP	ESI,2
	JE	L156
L34:
	CMP	ESI,3
	JNE	L19
	MOV	EAX,DWORD [-131120+EBP]
	MOV	AL,BYTE [EAX]
	MOV	BYTE [ECX],AL
	INC	ECX
	MOV	EDX,DWORD [-131120+EBP]
	MOV	AL,BYTE [EDX]
	CMP	AL,34
	JE	L132
	CMP	AL,37
	JNE	L19
	LEA	EAX,DWORD [1+EDX]
	MOV	DWORD [-131120+EBP],EAX
	MOV	AL,BYTE [1+EDX]
	JMP	L133
L132:
	XOR	ESI,ESI
	JMP	L19
L156:
	MOV	EAX,DWORD [-131120+EBP]
	CMP	BYTE [EAX],10
	JNE	L34
	JMP	L132
L155:
	MOV	EAX,DWORD [-131120+EBP]
	CMP	BYTE [EAX],42
	JNE	L32
	CMP	BYTE [1+EAX],47
	JNE	L32
	INC	EAX
	MOV	DWORD [-131120+EBP],EAX
	JMP	L132
L139:
	LEA	EDX,DWORD [1+ECX]
L11:
	MOV	EAX,EDX
	MOV	DWORD [-131120+EBP],EDX
	LEA	EDX,DWORD [2+ECX]
	MOV	ECX,EAX
	CMP	BYTE [-1+EDX],32
	JE	L11
	JMP	L120
	GLOBAL	_waittimer
_waittimer:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	DWORD [12+EBP]
	PUSH	DWORD [8+EBP]
	CALL	_api_settimer
	POP	EAX
	POP	EDX
L158:
	PUSH	1
	CALL	_api_getkey
	MOV	EBX,EAX
	POP	EAX
	CMP	EBX,81
	JE	L162
	CMP	EBX,113
	JE	L162
L161:
	ADD	EBX,-128
	JNE	L158
	MOV	EBX,DWORD [-4+EBP]
	LEAVE
	RET
L162:
	PUSH	0
	CALL	_api_beep
	CALL	_api_end
	POP	ECX
	JMP	L161
	GLOBAL	_end
_end:
	PUSH	EBP
	MOV	EBP,ESP
	MOV	EAX,DWORD [8+EBP]
	TEST	EAX,EAX
	JE	L165
	PUSH	EAX
	CALL	_api_putstr0
	POP	EAX
L165:
	PUSH	0
	CALL	_api_beep
	POP	ECX
	LEAVE
	JMP	_api_end
